package es.tikitaka.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import es.tikitaka.dao.MunicipioDicService;
import es.tikitaka.dictionary.MunicipioDic;
import es.tikitaka.dictionary.ProvinciaDic;

/**
 * 
 * @author Saúl Domínguez
 * @since 2010
 * @category PFC
 */
@Name("municipioService")
public class MunicipioDicServiceImpl implements MunicipioDicService {

	@In
	EntityManager em;

	public MunicipioDicServiceImpl() {
		// TODO Auto-generated constructor stub
	}

	@SuppressWarnings("unchecked")
	public List<MunicipioDic> getList(ProvinciaDic prov) {
		List<MunicipioDic> list = null;
		try {
			list = em
					.createQuery(
							"select m from MunicipioDic m where m.provincia.id =:prov order by m.municipio")
					.setParameter("prov", prov.getId()).getResultList();
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

	public boolean delete(Integer id) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean save(MunicipioDic mun) {
		// TODO Auto-generated method stub
		return false;
	}

}
